﻿using System.Collections.Generic;

public class IDataItem
{
    /// <summary>
    /// 唯一ID
    /// <summary>
    public int Id { get; private set; }
    public void Init(ExcelLineReader reader)
    {
        Id = reader.ReadInt();
    }
}

public class IDataMgr 
{
    public int mDataCount { get; private set; }
    protected virtual string FileName { get { return ""; } }
    public virtual void Load(ExcelLineReader reader) { }

    protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
    public int GetIdxById(int id) { return mItemDic[id]; }

    public void Init()
    {
        mDataCount = 0; ExcelReader reader = new ExcelReader();
        if (!reader.LoadFile(FileName))
        {
            reader.Clear(); return;
        }

        ExcelLineReader lineReader = reader.ReadLine();
        while (lineReader != null)
        {
            Load(lineReader); mDataCount++;
            lineReader = reader.ReadLine();
        }
        reader.Clear();
    }
}